XMLHttp = function() {
  self = this;
  if (typeof XMLHttpRequest != 'undefined')
  return new XMLHttpRequest();
  else if (window.ActiveXObject) {
    var avers = ["Microsoft.XmlHttp", "MSXML2.XmlHttp", "MSXML2.XmlHttp.3.0",  "MSXML2.XmlHttp.4.0", "MSXML2.XmlHttp.5.0"];
    for (var i = avers.length -1; i >= 0; i--) {
      try {httpObj = new ActiveXObject(avers[i]);
      return httpObj;
      } catch(e) {}
    }
  }
  throw new Error('XMLHttp (AJAX) not supported');
}

XMLHttp.prototype.get = function(url) {
  self.open('GET', url, true);
  self.onreadystatechange = function() {
     self.processRequest();}
  self.send(null);
}

XMLHttp.prototype.processRequest = function() {
  if (self.readyState == 4) {
    if (self.status != 200) {
      self.resp = 'Error : Status '+this.status+' returned.';
    } else {
      if (cType == 'text/xml') {
    self.resp = 'xml';
      } else if (cType == 'text/plain') {
    self.resp = 'text';
      } else {
    self.resp = 'unknown content type';
      }
      this.response();
    }
  }
}

ajaxObj = XMLHttp();
ajaxObj.get('myrequest.php');

ajaxObj2 = XMLHttp();
ajaxObj2.get('myrequest.php');

ajaxObj.response = function() {
  if (self.resp == 'xml') {
    alert(self.responseXML);
  } else if (self.resp == 'text') {
    alert(self.responseText);
  } else {
    alert(self.resp);
  }
}
ajaxObj2.response = function() {
  if (self.resp == 'xml') {
    alert(self.responseXML);
  } else if (self.resp == 'text') {
    alert(self.responseText);
  } else {
    alert(self.resp);
  }
}


====================================================================

function GetStuff(){
    for (var i = 0; i < arrStationID.length; i++){        
        var URL = "http://someWebSite.com/getthis.aspx?x=blah&y=blah2"
        ajaxThis(URL, parseGetResponse, true);
    }
}
 
 
//Use this function to do all your ajax related stuff.
function ajaxThis(url, callBackFunction, async){
    NewURL = url + "&randomnumber=" + Math.floor(Math.random()*10000);  //prevent browser caching by sending always sending a unique url.
    //alert(NewURL);
    var req = newXMLHttpRequest();    // Obtain an XMLHttpRequest instance
    var handlerFunction = getReadyStateHandler(req, callBackFunction);    // Set the handler function to receive callback notifications from the request object
    req.onreadystatechange = handlerFunction;
    req.open('GET', NewURL, async);  // Third parameter specifies request is asynchronous.
    req.send(null);
}
 
// Returns a new XMLHttpRequest object, or false if this browser doesn't support it
function newXMLHttpRequest() {
 
    var xmlreq = false;
    if (window.XMLHttpRequest) {
        // Create XMLHttpRequest object in non-Microsoft browsers
        xmlreq = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        // Create XMLHttpRequest via MS ActiveX
        try {
            // Try to create XMLHttpRequest in later versions
            // of Internet Explorer
            xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e1) {
            try {
                // Try version supported by older versions
                // of Internet Explorer
                xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e2) {
                doError(e2);
        }
    }
  }
  return xmlreq;
}
 
/* Returns a function that waits for the specified XMLHttpRequest
 * to complete, then passes its XML response
 * to the given handler function.
 * req - The XMLHttpRequest whose state is changing
 * responseXmlHandler - Function to pass the XML response to */
 
function getReadyStateHandler(req, responseXmlHandler) {
    // Return an anonymous function that listens to the 
    // XMLHttpRequest instance
    return function () {
    // If the request's status is "complete"
        if (req.readyState == 4) {
            // Check that a successful server response was received
 
            if (req.status == 200) {                  //todo: catch 404 error.
                // Pass the XML payload of the response to the 
                // handler function
                responseXmlHandler(req);
            }else{
                // An HTTP problem has occurred
                //alert("HTTP error: "+req.status);
                $('lblError').innerHTML += "HTTP error: "+req.status;
            }
        }
    }
}     